home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / passwd+ / sys.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-20  |  5.7 KB  |  152 lines

  1. /*
  2.  * system dependencies
  3.  *
  4.  * what you need to define:
  5.  *
  6.  * BASIC SYSTEM IDENTITY
  7.  *    BSD4_2        for vanilla 4.2 BSD systems
  8.  *    BSD4_3        for vanilla 4.3 BSD systems
  9.  *    SYSV        for vanilla System V systems
  10.  *    SUN        for Sun 3.0 OS on a client
  11.  * If one of these is set, everything else is done automatically.
  12.  * Note: your system must be vanilla for these to work; for example,
  13.  * a Sun is not vanilla 4.3 (or 4.2 for that matter) since it uses
  14.  * a System V password function, fgetpwent().
  15.  *
  16.  * ALTERNATE CAPABIOLITIES
  17.  *    CHFN        if your machine uses the passwd command to allow users
  18.  *            to change their finger information, define this
  19.  *    GETUSERSHELL    if your machine uses the passwd command to allow users
  20.  *            to change their login shell, set this to the function
  21.  *            that returns valid user shells.  The calling sequence
  22.  *            is to pass no arguments, and each call is expected to
  23.  *            return a string with the name of a valid user shell in
  24.  *            it, or NULL meaning end of list.
  25.  * These let you alter other fields of the password file.  Useful.
  26.  *
  27.  * PASSWORD FILE FORMAT
  28.  *    AGE_FIELD    set this if the password structure (see getpwent(3)
  29.  *            in the manual) has the field "pw_age".
  30.  *
  31.  * ALTERNATE PASSWORD FILE
  32.  *    FGETPWENT    define this function to take a FILE pointer to the
  33.  *            password file, and return successive entries in the
  34.  *            password files (or NULL when there are no more)
  35.  *    SETPWFILE    define this to take the name of the password file
  36.  *            as its single argument; it returns nothing, but all
  37.  *            future calls to getpwnam and getpwuid get the entries
  38.  *            from this file and not the default one.
  39.  * Define only one of these (BSD systems use the latter, System V the former).
  40.  * Look in the manual entry for getpwent() to which one to use.  If no such
  41.  * function is given, you're stuck -- you can't use an alternate file.
  42.  * don't define either.
  43.  *
  44.  * SYSTEM LIBRARIES
  45.  *    SYSLOG        set to library to load syslog(3), openlog(3), and
  46.  *            closelog(3) from; if standard C library, just define
  47.  *            it; if not available, don't define it
  48.  *    DBMLIB        DEFINE THIS ONLY IF YOUR PASSWORD FILE IS ALSO STORED
  49.  *            USING DBM FORMAT; OTHERWISE THERE MAY BE PROBLEMS.
  50.  *            set to library to load dbm routines; if standard C
  51.  *            library, just define it; if not available, don't
  52.  *            define it
  53.  * These define libraries where functions may be found.  Note the warning
  54.  * for DBMLIB -- we mean it!
  55.  *
  56.  * SYSTEM TYPES
  57.  *    UID_TYPE    if getuid(2) does not return an int, set this to the
  58.  *            type that getuid(2) returns
  59.  * This is put in to keep lint happy, but mind the types and the data will
  60.  * take care of itself, I always say ...
  61.  *
  62.  * SYSTEM FUNCTIONS
  63.  *    RENAME        define this to be a function that renames files 
  64.  *            atomically; it takes two arguments, the old name and
  65.  *            the new name (in that order); if your system does not
  66.  *            have one, do not define it, and the old password file
  67.  *            will be unlinked and the new one linked to the name of
  68.  *            the old one, leaving a small window of vulnerability if
  69.  *            your system chooses that minute to crash *sigh*;
  70.  *    OPENLOG        define this to have the appropriate arguments; the
  71.  *            calls on 4.2 BSD and 4.3 BSD differ (used only if
  72.  *            SYSLOG is defined)
  73.  *    GETDOMAIN    define this to be a function of two arguments,
  74.  *            char buf[] and int n, where n is the size in chars
  75.  *            of buf[]; on return, buf[] contains the domain name
  76.  *            (ie, the first n characters of it); the call made is
  77.  *            GETDOMAIN(buf, BUFSIZ); if no such function available,
  78.  *            do not define it
  79.  *    GETHOST        define this to be a function of two arguments,
  80.  *            char buf[] and int n, where n is the size in chars
  81.  *            of buf[]; on return, buf[] contains the host name
  82.  *            (ie, the first n characters of it); the call made is
  83.  *            GETHOST(buf, BUFSIZ); if no such function available,
  84.  *            do not define it
  85.  * These functions are system calls on some machines, library functions
  86.  * on other machines, and do not exist on still others.  If GETDOMAIN is
  87.  * not defined, the host name is obtained and everything up to (and including)
  88.  * the first '.' is clobbered.
  89.  *
  90.  * HOST NAME
  91.  *    HOSTNAME    define this if GETHOST is not defined; it should be
  92.  *            the full, DOMAIN NAME of your site (so if you are
  93.  *            working on the host "prandtl", for example, define
  94.  *            HOSTNAME as "prandtl.nas.nasa.gov")
  95.  * If GETHOST is defined, this macro is ignored.
  96.  *
  97.  * DEBUGGING
  98.  *    ALLOWCORE    if set this allows core dumps to be produced; it should
  99.  *            only be used for debugging
  100.  *    ROOTID        if set, this is the numeric UID of root; it is used in
  101.  *            debugging to allow someone other than the superuser
  102.  *            to use a test file other than the default.
  103.  * Useful only for debugging.  NEVER RUN IN PRODUCTION MODE WITH THESE SET --
  104.  * you guess why.
  105.  */
  106.  
  107. /*
  108.  * these are the settings for a vanilla SUN system
  109.  */
  110. #ifdef SUN
  111. #    define BSD4_PASSWD
  112. #    define FGETPWENT        fgetpwent
  113. #    define SYSLOG
  114. #    define RENAME(old, new)        rename(old, new)
  115. #    define OPENLOG(id,log,fac)    openlog(id,log)
  116. #    define GETDOMAIN        getdomainname
  117. #    define GETHOST            gethostname
  118. #    define YPPASSWD
  119. struct passwd *fgetpwent();
  120. #endif
  121.  
  122. /*
  123.  * these are the settings for a vanilla 4.2 BSD system
  124.  */
  125. #ifdef BSD4_2
  126. #    define BSD4_PASSWD
  127. #    define CHFN
  128. #    define GETUSERSHELL()        getusershell()
  129. #    define RENAME(old, new)        rename(old, new)
  130. #    define OPENLOG(id,log,fac)    openlog(id,log)
  131. #    define SYSLOG
  132. #    define UID_TYPE            int
  133. #    define GETHOST            gethostname
  134. #endif
  135.  
  136. /*
  137.  * these are the settings for a vanilla 4.3 BSD system
  138.  */
  139. #ifdef BSD4_3
  140. #    define BSD4_PASSWD
  141. #    define SETPWFILE        setpwfile
  142. #    define CHFN
  143. #    define GETUSERSHELL()        getusershell()
  144. #    define RENAME(old, new)        rename(old, new)
  145. #    define OPENLOG(id,log,fac)    openlog(id,log,fac)
  146. #    define SYSLOG
  147. #    define DBMLIB            -ldbm
  148. #    define UID_TYPE            uid_t
  149. #    define GETHOST            gethostname
  150. #endif
  151.  
  152.